import React, { Component } from 'react';
import FlowChartComponent from './FlowChartComponent';
import { inject, observer } from 'mobx-react';

// variety 公文种类 classify 主题分类统计  monthly 月度公文
@inject('reportStore')
@observer
class OdocCountEchartsComp extends Component {
  constructor(props) {
    super(props);
    this.type = props.params.id;
  }

  componentDidMount() {
    const { reportStore } = this.props;
    const { doSearch, setSelectedTab } = reportStore;
    setSelectedTab(1);
    doSearch({ dateType: 0, orgtype: 1 });
  }

  render() {
    const { reportStore } = this.props;
    const { docChart1title, docChart2title, docChart3title, docChart1, docChart2, docChart3 } = reportStore;
    return (
      <div>
        {this.type == 'variety' && <FlowChartComponent ecId={`${this && this.props && this.props.ecId || ''}_FlowChartComponent@szb5af`} title={`${docChart1title}（Top10）`} id="docchart1" echart={docChart1} needDailog={true} />}
        {this.type == 'classify' && <FlowChartComponent ecId={`${this && this.props && this.props.ecId || ''}_FlowChartComponent@08as83`} title={`${docChart2title}（Top10）`} id="docchart2" echart={docChart2} needDailog={true} />}
        {this.type == 'monthly' &&
          <div className="report-row div_docchart3">
            <FlowChartComponent ecId={`${this && this.props && this.props.ecId || ''}_FlowChartComponent@xhczk9`} title={docChart3title} id="docchart3" echart={docChart3} needDailog={true} />
          </div>
        }
      </div>

    );
  }
}

export default OdocCountEchartsComp;
